#!/bin/bash

if [ $# -lt 1 ] ; then
	echo "usage: $0 testfile"
	exit 1
fi


if [ ! -f $1 ] ; then
	echo $1 is not a valide file!
	exit 1
fi

testfile=$1
filename=$(echo $1 | awk '{split($1,A,"/");print A[length(A)]}')
dir=$(echo $testfile | sed -e "s/$filename//")


resultpostfix=$(echo $filename | sed -e 's/test//' | sed -e 's/\.hl//')
profresults=${dir}Results4/results$resultpostfix
myresults=myresults$resultpostfix


echo reading $testfile and comparing $profresults with $myresults


java -cp build:AST TestParser $testfile > $myresults
diff $profresults $myresults
